package com.qys.training.biz.alive.service.impl;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.qys.training.biz.alive.entity.AliveEntity;
import com.qys.training.biz.alive.service.AliveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Winstone
 * @date 2020/8/5 - 3:54 下午
 */
@Service
public class AliveServiceImpl implements AliveService {

    @Autowired
    HazelcastInstance instance;

    public AliveEntity getTopic() {
        IMap<String,String> map = instance.getMap("aliveMap");

        AliveEntity entity = new AliveEntity();
        entity.setServerList(map);
        entity.setTotal(map.size());
        return entity;
    }

}
